<table width=80% border=0 class="tabla1">
<tr>
	<th background="images/bggen2.jpg">Files</th>
</tr>
<?php
	$owner = $_GET['id'];

	$query = "SELECT id, name, author, description, date, category, filename, problemId FROM files WHERE ownerId = '$owner' ORDER BY category ";
	$result = mysql_query($query) or die('Error, query failed');
	if (mysql_num_rows($result) > 0) {
		while (list($id, $name, $auth, $desc, $date, $cat, $filename, $problemId) = mysql_fetch_array($result)) {
			$problem="";
			$query="SELECT CCRDataObjectID, productName FROM problems WHERE patientID='$owner' AND id='$problemId'";
			$result2 = mysql_query($query) or die('Error, query failed');
			if (mysql_num_rows($result2) != 0) {
				$problem=mysql_result($result2,0,"productName")." ".mysql_result($result2,0,"CCRDataObjectID");
			}
			?>
			<tr><td align=center>
				<table border=1>
					<tr><td>Name</td><td><?php echo $name;?></td></tr>
					<tr><td>Author</td><td><?php echo $auth;?></td></tr>
					<tr><td>Description:</td><td><?php echo $desc;?></td></tr>
					<tr><td>Category:</td><td><?php echo $cat;?></td></tr>
					<tr><td>Date:</td><td><?php echo $date;?></td></tr>
					<tr><td>Related to problem:</td><td><?php echo $problem; ?></td></tr>
					<tr><td>Download:</td><td><a href="./fileScripts/controllers/getFile.php?fileId=<?php echo $id;?>"><?php echo $filename;?></a></td></tr>
				</table>
			</td></tr>
			<?php 	
		}
	}
?>
<tr>
	<td>
		<a href="./index.php?mode=subeArchivo&id=<? echo $owner; ?>" class="style1"> Agregar Archivo </a>
	</td>
</tr>
 </table>